import React, { useEffect, useRef, useState } from "react";
import { Grid, ProgressBar, Space } from "antd-mobile";
import { useSession } from "next-auth/react";
import useGameK from "@/components/pages/game/car/stores/useGameK";

const pageName = "game.header";
const klassName = pageName.replace(/\./g, '-');

export default function VReadyComp({passed, distance, speed, avatar}) {

  const {data} = useSession();
  let duration = useGameK(state => state.duration)
  const isInApp = useState(()=> {
    if (window.QYApp) {
      return true
    }
    return false
  })
  return (
    <div className={`cp-${klassName} ${isInApp? `cp-${klassName}-app`: ''}`}>
      <div className="inner">
        {/*<Avatar src={`${process.env.NEXT_PUBLIC_AVATAR_URL}${data?.user?.extra?.avatar}`} />*/}

        {/* <span>{((passed) / 1000).toFixed(1)}s</span> */}
        <Space justify="between" direction="horizontal" align="center" block>
          <span className="game-time">
          时间：{((passed) / 1000).toFixed(1)}s</span>
          <span className="game-score">分数：{(distance / 1000).toFixed(0)}</span>
        </Space>
        
        

        

        {/*<span>{speed}m/s</span>*/}
      </div>
    </div>
  )
}

